<div style="padding: 2em;">
    <fieldset style="margin-bottom: 1em;">
        <legend>Каталог</legend>

        <div style="width: 34%; float: left">
            <div class="PageMenu" style="min-height: 2em">
                <?php echo $this->FieldTypes(); ?>
                <div style="display: inline-block">Поиск <input class="Text" type="text" id="FindRec"/></div>
            </div>
            <?php echo $this->DictionarySwitch()->ToHtml(); ?>
        </div>

        <div style="width: 65%; float: right; ">
            <div class="PageMenu" style="min-height: 2em; text-align: center">
<!--                <button id="ClearSelectin">Очистить</button>
                <button id="GoToOrder">Оформить заказа</button>-->
                <?php echo $this->ControllElements(); ?>
            </div>

            <div id="SearchResult"
                 style="overflow-x: hidden; overflow: auto; border: 1px solid lightgrey">
                <?php echo $this->SearchResultSwitch()->ToHtml(); ?>
            </div>
        </div>

    </fieldset>

    <div class="PageMenu">
    </div>

    <script type="text/javascript" id="EditFindScript">
        jsun.run(function() {
            jsun("#FieldType").jsun.event({ onchange: Search });
            jsun("#FindRec").jsun.event({ onkeyup: Search, onchange: Search });
            jsun("#ClearSelectin") && jsun("#ClearSelectin").jsun.event({ onclick: ClearSelectin });
            jsun("#GoToOrder") && jsun("#GoToOrder").jsun.event({ onclick: GoToOrder });

            var pref = "CatalogDictionary",
                param = "u=Index&m=Index\\Catalog/Dictionary&field_id=";

            function Search() {
                jsun.swap[pref].Req = param
                    + jsun("#FieldType").value
                    + "&rec=" + encodeURIComponent(jsun("#FindRec").value);
                jsun.swap[pref].Page = 1;
                jsun.swap[pref].Start();
            }

            function GoToOrder() {
                window.location = "?u=Reader&p=Reader\\Order/Add";
            }

            function ClearSelectin() {
                jsun.ajax.send_request({ asyn: false, param: "u=Index/ClearItems" });
                if (!jsun("#EditList")) return;

                var list = jsun("#EditList").firstChild.childNodes;
                for (var i = 1; i < list.length; ++i) {
                    list[i].lastChild.firstChild.checked = false;
                }
            }

            function Resize() {
                jsun('#SearchResult').style.height = (window.innerHeight - 240) + 'px';
            }

            Search();
            Resize();
            window.onresize = Resize;
        });
    </script>
</div>